package com.example.tests;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import org.testng.annotations.*;

public class ContactCreationTests extends TestBase {

  @Test(dataProvider = "contactsFromXmlFile")
  public void testContactCreationWithValidData(ContactData contact) {
	app.getContactHelper().createContact(contact);
	if (wantToCheck()) {
    	if ("yes".equals(app.getProperty("check.db"))) {
    		assertThat(app.getModel().getContacts(), equalTo(app.getHebirnateHelper().listContacts()));
    	}
    	if ("yes".equals(app.getProperty("check.ui"))) {
    		assertThat(app.getModel().getContacts(), equalTo(app.getContactHelper().getUiContacts()));
    	}
    }	
  }
}
